<template>
  <div class="navbar">
    <div class="wrapper">
      <div class="left" style="flex: 3">
        <img class="logo" src="~@/assets/logo.png">
      </div>
      <div style="width: 20%">

      </div>
      <ul class="right">
        <li v-for="(item,index) in menu"
            :key="index"
            :class="{active:index===currentIndex}"
            @click="handleLink(index)">{{item.name}}</li>
      </ul>
    </div>
  </div>
</template>

<script>
  export default {
    name: "Navbar",
    data() {
      return {
        currentIndex:0,
        menu:[
          {
            name:'首页',
            path:'/'
          },
          {
            name:'学校概况',
            path:'/situation'
          },
          {
            name:'师资队伍',
            path:'/teaching'
          },
          {
            name:'学科专业',
            path:'/index'
          },
          {
            name:'招生信息',
            path:'/recruit'
          },{
            name:'信息公开',
            path:'/info'
          },
          {
            name:'校园生活',
            path:'/live'
          }
        ]
      }
    },
    methods: {
      handleLink(index){
        this.currentIndex=index
        this.$router.push('/home')
      }
    }
  }
</script>

<style scoped>
  .navbar{
    background-color: #ffffff;
  }
  .wrapper {
    margin: 0 auto;
    display: flex;
    line-height: 60px;
    height: 60px;
    width: 1350px;
  }

  .logo {
    height: 45px;
    margin-top: 8px;
    margin-left: 10px;
  }

  .right {
    flex: 9;
    display: flex;
    justify-content: space-evenly;
    line-height: 60px;
    font-size: 15px;
    text-align: center;
  }

  .right li{
    width: 75px;
    transition: .1s;
  }

  .right li:hover{
    color: var(--color-high-text);
  }

  .active {
    font-size: 18px;
    font-weight: bold;
    border-bottom: 3px solid var(--color-high-text);
    color: var(--color-high-text);
  }
</style>
